const coins = [1,2,5]
amount = 11


var coinChange = function(coins, amount) {
    let num = 0
    for(let i=coins.length-1;i>=0;i--){
        num=num+Math.floor(amount/coins[i]);
        amount = amount % coins[i]
        
    }
    
    console.log(num);
    if(amount==0){
    return num;
    }else{
        return -1
    }

}
    
coinChange(coins,amount)